<template>
  <div class="block">
    <h2>待办事项（{{ waitTotal }}）</h2>
    <ul>
      <li v-for="(item, i) in waitList" :key="i">
        {{ i + 1 }}.{{ item.name }}<span>{{ item.amount }}</span
        >条
      </li>
    </ul>
  </div>
</template>

<script>
import baseView from "@/views/base";
import { utils } from "hi-ui";
import dataViewCfg from "./dataset.js";

export default {
  name: "waitList",
  extends: baseView,
  components: {},
  data() {
    return {
      dataset: null,
      dataViewCfg: dataViewCfg,
      waitList: [
        {
          name: "采购订货",
          amount: 0,
        },
        {
          name: "验收入库",
          amount: 0,
        },
        {
          name: "采购退货",
          amount: 0,
        },

        {
          name: "采购结算",
          amount: 0,
        },
        {
          name: "其他出库",
          amount: 0,
        },
        {
          name: "其他入库",
          amount: 0,
        },

        {
          name: "商品拆分",
          amount: 0,
        },
        {
          name: "商品组合",
          amount: 0,
        },
        {
          name: "库存盘点",
          amount: 0,
        },
        {
          name: "盘点盈亏处理",
          amount: 0,
        },
        {
          name: "缺货药品",
          amount: 0,
        },
        {
          name: "积货药品",
          amount: 0,
        },
      ],
      waitTotal: 0,
    };
  },
  computed: {},
  watch: {},
  methods: {},
  mounted() {
    //创建主数据集
    this.dataset = this.$dsContainer.createDataSet(this.dataViewCfg);
    this.dataset.load().then(() => {});
    let me = this;
    this.dataset.on("afterload", (response, data) => {
      if (data.length > 0) {
        for (let i = 0; i < data.length; i++) {
          this.waitTotal += data[i].FACOUNT;
          me.waitList.forEach((element) => {
            if (data[i].FNAME == element.name) {
              element.amount = data[i].FACOUNT;
            }
          });
        }
      }
    });
  },
};
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
.block {
  height: 100%;
  // padding: 0 0 10px;
  * {
    margin: 0;
    padding: 0;
  }
  h2 {
    height: 46px;
    line-height: 46px;
    font-size: 16px;
    padding: 0 20px;
    font-weight: bold;
  }

  ul {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    position: relative;
    height: calc(100% - 56px);
    overflow: auto;
    &:after {
      content: "";
      position: absolute;
      height: calc(100% - 20px);
      width: 1px;
      background-color: #f0f0f0;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      margin: auto;
    }
    li {
      height: 28px;
      line-height: 28px;
      font-size: 14px;
      color: #666;
      flex: 0 0 50%;
      padding-left: 20px;
      span {
        color: #f60;
        font-size: 16px;
        padding: 0 5px;
      }
    }
  }
}
</style>
